package com.mj.postcode.service;

import java.util.List;

import android.content.Context;

import com.mj.postcode.bean.Postcode;
import com.mj.postcode.dao.PostcodeDao;

/**
 * 邮编查询Service
 * @author zhaominglei
 * @date 2015-11-10
 * 
 */
public class PostcodeService extends BaseService {
	@SuppressWarnings("unused")
	private static final String TAG = PostcodeService.class.getSimpleName();
	private PostcodeDao postcodeDao = new PostcodeDao();
	
	public Postcode getAddressInfo(Context context, String referer, String code) {
		if (code != null && !code.equals("")) {
			return postcodeDao.getPostcodeByCode(context, code);
		}
		return null;
	}
	
	public List<String> getProvinces(Context context) {
		return postcodeDao.getProvinces(context);
	}
	
	public List<String> getCities(Context context, String province) {
		return postcodeDao.getCities(context, province);
	}
	
	public List<String> getDistricts(Context context, String province, String city) {
		return postcodeDao.getDistricts(context, province, city);
	}
	
	public List<Postcode> getCodeInfo(Context context, String referer, String province, String city, String district, String address) {
		if (province != null && !province.equals("") 
				&& city != null && !city.equals("") 
				&& district != null && !district.equals("")) {
			return postcodeDao.getCodeInfo(context, province, city, district, address);
		}
		return null;
	}
}
